#include <glib.h>
static void _queue_foreach_func(gpointer data, gpointer user_data)
{
    g_print("user_data:%s, data:%d \n", (gchar *)user_data, GPOINTER_TO_INT(data));
}

gint main(gint argc, gchar **argv)
{
    GQueue *q = NULL;

    q = g_queue_new();

    g_queue_push_tail(q, GINT_TO_POINTER(1));
    g_queue_push_tail(q, GINT_TO_POINTER(3));
    g_queue_push_tail(q, GINT_TO_POINTER(5));

    g_queue_foreach(q, _queue_foreach_func, "Queue-ori");

    //reverse
    g_queue_reverse(q);

    g_queue_foreach(q, _queue_foreach_func, "Queue-reverse");

    g_queue_free(q);

    return 0;
}